﻿/*
 * Erstellt mit SharpDevelop.
 * Benutzer: Kai Patrick
 * Datum: 19.03.2008
 * Zeit: 10:30
 * 
 * Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
 */

using System;
using System.Collections.Generic;
using System.Xml.Linq;

namespace Gamadus.Core.Resources
{
	public class Action
	{
		ActionPrototype m_prototype;
		
		public ActionPrototype Prototype
		{
			get
			{
				return m_prototype;
				
			}
		}
		
		public string Description
		{
			get
			{
				return String.Format(System.Globalization.CultureInfo.InvariantCulture,Prototype.DescriptionPrototype, GetDisplayValues());
			}
		}
		
		public string[] GetDisplayValues()
		{
			string[] array = new string[paramList.Count];
			int i = 0;
			foreach(ActionParam param in paramList.Values)
			{
				array[i++] = param.DisplayValue;
			}
			return array;
		}
		
		public string[] GetCodeValues()
		{				
			string[] array = new string[paramList.Count];
			int i = 0;
			foreach(ActionParam param in paramList.Values)
			{
				array[i++] = param.CodeValue;
			}
			return array;
		}
		
		Dictionary<string,ActionParam> paramList = new Dictionary<string,ActionParam>();
		
		public Dictionary<string,ActionParam> ParamList
		{
			get
			{
				return paramList;
			}
		}
		
		public string Name
		{
			get
			{
				return Prototype.Name;
			}
		}
		
		public Action(Resources.ActionPrototype prototype)
		{
			m_prototype = prototype;
			foreach(var param in prototype.ParamTypes)
			{
				paramList[param.Key] = param.Value.Create();
			}
		}
		
//		public Action Clone()
//		{
//			Action action = (Action)this.MemberwiseClone();
//			action.paramList = new Dictionary<string,ActionParam>();
//			foreach(KeyValuePair<string, ActionParam> param in paramList)
//			{
//				action.paramList.Add(param.Key,param.Value.Clone());
//			}
//			return action;
//		}
//		
//		public void ShowEditForm()
//		{
//			Prototype.ShowEditForm(this);
//		}
	}

}
